#ifndef __LSE_H__
#define __LSE_H__

#include <iostream>
#include "Forest.h"
#include "Distance.h"

//Forward Declaration
class Rse;


//left subforest enumeration

class Lse 
{
	Tree* inTree;//the initial G trees
	Forest W;//parameter that is used to update the Tables
	vector<Tree*>* Table;//Table[i][j] - the leftmost node of the Gij Forest
	vector<int>* ForestSize;//ForestSize[i][j] - the cost of deleting the Gij forest
	int currSize;//parameter that is used to update the ForestSize array
	Distance* distance;

public:
	Lse(Tree* G, Distance* distance1);
	~Lse();
	void Right_To_Left_Preorder_Traversal(Tree* G, bool restart);//sets the value of RTLP field of each node in G
	void Convert(vector<int>* T,Rse& rse);//converts the Table T from RSE to LSE
	void find_Lse(Tree* G);//computes the LSE of the tree G
	void DeleteRightVertex(int i,Tree* G);//updates W for i right deletions
	void DeleteLeftVertex(int i,int j);//updates the Ttable for j left deletions from W after i right deletions have been made
	Tree* GetT(){return inTree;}

	Tree* GetForest(int i,int j);//return the left most node of Gij
	int get_JofI(int i);
	int getForestSize(int i,int j);//return the delete cost of the forest Gij
	

	
};

#endif //__LSE_H__